﻿<UserControl x:Class="ProgrammersCalculator.View.StringToBinary"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:con="clr-namespace:ProgrammersCalculator.Convertor"
             xmlns:s="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d"
             d:DesignHeight="600"
             d:DesignWidth="600">
    <UserControl.Resources>
        <con:StringToBinary x:Key="bin"></con:StringToBinary>
    </UserControl.Resources>
    <DockPanel>
        <Border DockPanel.Dock="Top"
                Style="{DynamicResource styleContentArea}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <!-- HEADER -->
                <Border Grid.Row="0"
                        Style="{DynamicResource styleContentAreaHeader}">
                    <Grid>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock FontSize="20"
                                       Padding="8"
                                       VerticalAlignment="Center">String To Binary</TextBlock>
                        </StackPanel>
                    </Grid>
                </Border>

                <!--CONTENT AREA-->
                <Grid Grid.Row="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <StackPanel>
                            <Label Content="Enter String:"
                                   FontFamily="Verdana" />
                            <TextBox x:Name="txtString"
                                     AcceptsReturn="True"
                                     Text="{Binding InputData,UpdateSourceTrigger=PropertyChanged}"
                                     Height="200"
                                     TextWrapping="Wrap" />
                        </StackPanel>
                        <StackPanel Grid.Row="1">
                            <GroupBox>
                                <StackPanel Orientation="Horizontal"
                                            Margin="10"
                                            VerticalAlignment="Top">
                                    <RadioButton x:Name="chkBinary"
                                                 Command="{Binding CheckBoxChangedCommand}"
                                                 CommandParameter="{Binding Content, ElementName=chkBinary}"
                                                 IsChecked="True">Binary Format</RadioButton>
                                    <RadioButton x:Name="chkHex"
                                                 Command="{Binding CheckBoxChangedCommand}"
                                                 CommandParameter="{Binding Content, ElementName=chkHex}">Hex Format</RadioButton>

                                </StackPanel>
                            </GroupBox>
                        </StackPanel>
                        <StackPanel Grid.Row="2">
                            <Label Content="Binary Equivalent:"
                                   Grid.Row="1"
                                   FontFamily="Verdana" />
                            <TextBox Grid.Column="1"
                                     Grid.Row="1"
                                     AcceptsReturn="True"
                                     Height="400"
                                     Text="{Binding Path=OutputData}"
                                     TextWrapping="Wrap">
                                <!--<TextBox.Text>
                                    <MultiBinding  Converter="{StaticResource bin}">
                                        <Binding ElementName="txtString"
                                                 Path="Text"></Binding>
                                        <Binding Path="Tag"
                                                 ElementName="chkBinary" />
                                        <Binding ElementName="chkHex"
                                                 Path="Tag" />
                                    </MultiBinding>
                                </TextBox.Text>-->
                            </TextBox>
                        </StackPanel>
                    </Grid>
                </Grid>
            </Grid>
        </Border>
    </DockPanel>
</UserControl>
